package com.fjwt.gz.mch.ctrl.score.rule;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fjwt.gz.core.model.ApiRes;
import com.fjwt.gz.db.entity.AgentScoreRuleEntity;
import com.fjwt.gz.db.vo.AgentScoreRuleVO;
import com.fjwt.gz.mch.ctrl.CommonCtrl;
import com.fjwt.gz.service.impl.AgentScoreRuleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  积分规则接口类
 */
@Slf4j
@RestController
@RequestMapping("/api/scoreRule")
public class ScoreRuleController extends CommonCtrl {

    @Autowired
    private AgentScoreRuleService agentScoreRuleService;

    /**
     * 积分规则列表
     */
    @PostMapping("/getList")
    public ApiRes getList(){
        String agentNo = getValString("agentNo");
        log.info("fans端积分规则列表，请求地址：/api/scoreRule/getList，请求参数：{}", agentNo);
        IPage<AgentScoreRuleVO> list = agentScoreRuleService.findScoreRuleList(getIPage(),agentNo);
        log.info("fans端积分规则列表，请求地址：/api/scoreRule/getList，返回结果：{}", list);
        return ApiRes.page(list);
    }
}
